#!/bin/sh
#
# This is the script for generating files for a specific Dalton test job.
#
# For the .check file ksh or bash is preferred, otherwise use sh
# (and hope it is not the old Bourne shell, which will not work)
#
if [ -x /bin/ksh ]; then
   CHECK_SHELL='#!/bin/ksh'
elif [ -x /bin/bash ]; then
   CHECK_SHELL='#!/bin/bash'
else
   CHECK_SHELL='#!/bin/sh'
fi


#######################################################################
#  TEST DESCRIPTION
#######################################################################
cat > benchmark_eri_r12.info <<'%EOF%'
   benchmark_eri_r12
   -----------------
   Molecule:         Methane (CH4)
   Wave Function:    MP2-R12 / 6-311G**
   Test Purpose:     Check R12 method with auxiliary basis and symmetry
                     using ERI integral code
%EOF%

#######################################################################
#  MOLECULE INPUT
#######################################################################
cat > benchmark_eri_r12.mol <<'%EOF%'
INTGRL
Direct MP2-R12/B calculation using symmetry

#    4    2 XY XZ
Atomtypes=4 Generators=2 XY XZ
# 1      6.    1    4    1    1    1    1
Charge=6.0 Set=1 Atoms=1 Blocks=4 1 1 1 1
C      0.000000000000000   0.000000000000000   0.000000000000000       *
H  12    5
     4563.2400000000        0.0019666500        0.0000000000        0.0000000000
                            0.0000000000        0.0000000000
      682.0240000000        0.0152306000        0.0000000000        0.0000000000
                            0.0000000000        0.0000000000
      154.9730000000        0.0761269000        0.0000000000        0.0000000000
                            0.0000000000        0.0000000000
       44.4553000000        0.2608010000        0.0000000000        0.0000000000
                            0.0000000000        0.0000000000
       13.0290000000        0.6164620000        0.0000000000        0.0000000000
                            0.0000000000        0.0000000000
        1.8277300000        0.2210060000        0.0000000000        0.0000000000
                            0.0000000000        0.0000000000
       20.9642000000        0.0000000000        0.1146600000        0.0000000000
                            0.0000000000        0.0000000000
        4.8033100000        0.0000000000        0.9199990000        0.0000000000
                            0.0000000000        0.0000000000
        1.4593300000        0.0000000000       -0.0030306800        0.0000000000
                            0.0000000000        0.0000000000
        0.4834560000        0.0000000000        0.0000000000        1.0000000000
                            0.0000000000        0.0000000000
        0.1455850000        0.0000000000        0.0000000000        0.0000000000
                            1.0000000000        0.0000000000
        0.0438000000        0.0000000000        0.0000000000        0.0000000000
                            0.0000000000        1.0000000000
H   6    4
       20.9642000000        0.0402487000        0.0000000000        0.0000000000
                            0.0000000000
        4.8033100000        0.2375940000        0.0000000000        0.0000000000
                            0.0000000000
        1.4593300000        0.8158540000        0.0000000000        0.0000000000
                            0.0000000000
        0.4834560000        0.0000000000        1.0000000000        0.0000000000
                            0.0000000000
        0.1455850000        0.0000000000        0.0000000000        1.0000000000
                            0.0000000000
        0.0438000000        0.0000000000        0.0000000000        0.0000000000
                            1.0000000000
H   3    3
        2.5040000000        1.0000000000        0.0000000000        0.0000000000
        0.6260000000        0.0000000000        1.0000000000        0.0000000000
        0.1565000000        0.0000000000        0.0000000000        1.0000000000
H   1    1
        0.8000000000        1.0000000000
# 1      1.    1    3    1    1    1 
Charge=1.0 Atoms=1 Blocks=3 1 1 1 Set=1
H      1.276731000000000   1.276731000000000   1.276731000000000       *
H   6    4
       33.8650000000        0.0254938000        0.0000000000        0.0000000000
                            0.0000000000
        5.0947900000        0.1903730000        0.0000000000        0.0000000000
                            0.0000000000
        1.1587900000        0.8521610000        0.0000000000        0.0000000000
                            0.0000000000
        0.3258400000        0.0000000000        1.0000000000        0.0000000000
                            0.0000000000
        0.1027410000        0.0000000000        0.0000000000        1.0000000000
                            0.0000000000
        0.0360000000        0.0000000000        0.0000000000        0.0000000000
                            1.0000000000
H   3    3
        3.0000000000        1.0000000000        0.0000000000        0.0000000000
        0.7500000000        0.0000000000        1.0000000000        0.0000000000
        0.1875000000        0.0000000000        0.0000000000        1.0000000000
H   1    1
        1.0000000000        1.0000000000
# 2      6.    1    5    3    3    3    2    2
Blocks=5 3 3 3 2 2 Set=2 Charge=6.0 Atoms=1
C      0.000000000000000   0.000000000000000   0.000000000000000       *
F   7    0
949028.800000000
142083.000000000
32332.4700000000
9158.11700000000
2987.90900000000
1078.78800000000
420.830800000000
F   6    0
174.600300000000
76.1829200000000
34.6358800000000
16.2707600000000
7.85547900000000
3.88217200000000
F   6    0
1.92833400000000
.835806000000000
.386291000000000
.176860000000000
.802520000000000E-01
.350000000000000E-01
F   5    0
1147.61900000000
272.869500000000
89.0820700000000
34.2494500000000
14.5453200000000
F   5    0
6.57360100000000
3.10769700000000
1.52739000000000
.768646000000000
.389539000000000
F   4    0
.197324000000000
.993640000000000E-01
.485870000000000E-01
.250000000000000E-01
F   3    0
24.0000000000000
10.4000000000000
4.54200000000000
F   3    0
1.97900000000000
.862100000000000
.375600000000000
F   2    0
.163600000000000
.636000000000000E-01
F   3    0
5.50000000000000
2.63100000000000
1.25500000000000
F   3    0
.598800000000000
.285700000000000
.118000000000000
F   2    0
2.65200000000000
1.20400000000000
F   2    0
.547000000000000
.254000000000000
# 2      1.    1    3    2    2    2 
Atoms=1 Charge=1.0 Blocks=3 2 2 2 Set=2
H      1.276731000000000   1.276731000000000   1.276731000000000       *
F   5    0
    402.0000000
     60.2400000
     13.7300000
      3.9050000
      1.2830000
F   4    0
      0.4655000
      0.1811000
      0.0727900
      0.0207000
F   3    0
     11.9000000
      4.5160000
      1.7120000
F   3    0
      0.6490000
      0.2460000
      0.0744000
F   2    0
      2.9500000
      1.2060000
F   2    0
      0.4930000
      0.1560000
%EOF%

#######################################################################
#  DALTON INPUT
#######################################################################
cat > benchmark_eri_r12.dal <<'%EOF%'
**DALTON INPUT
.RUN WAVE FUNCTION
.DIRECT
*MOLBAS
.R12AUX
**INTEGRALS
.R12
**WAVE FUNCTIONS
.CC
*SCF INPUT
.THRESHOLD
 1D-9
*CC INPUT
.MP2
.PRINT
 3
*ORBITALS
.MOSTART
 H1DIAG
**END OF DALTON INPUT
%EOF%

#######################################################################

 

#######################################################################

#######################################################################
#  CHECK SCRIPT
#######################################################################
echo $CHECK_SHELL >benchmark_eri_r12.check
cat >>benchmark_eri_r12.check <<'%EOF%'
log=$1

if [ `uname` = Linux ]; then
   GREP="egrep -a"
else
   GREP="egrep"
fi
#                    ! Auxiliary-basis MP2-R12 method !
#             MP2-R12/A   correlation energy =   -0.255279166
#             MP2-R12/B   correlation energy =   -0.251671657
CRIT1=`$GREP "MP2-R12/A   correlation energy =   \-0*\.25527916" $log | wc -l`
TEST[1]=`expr	$CRIT1`
CTRL[1]=1
ERROR[1]="MP2-R12/A ENERGY NOT CORRECT"

PASSED=1
for i in 1 
do 
   if [ ${TEST[i]} -ne ${CTRL[i]} ]; then
     echo "${ERROR[i]} ( test = ${TEST[i]}; control = ${CTRL[i]} ); "
     PASSED=0
   fi
done 

if [ $PASSED -eq 1 ]
then
  echo TEST ENDED PROPERLY
  exit 0
else
  echo THERE IS A PROBLEM 
  exit 1
fi

%EOF%
#######################################################################
